package com.zycfc.zsf.boot.common.context;

import java.util.*;

public class ThreadLocalContextCore implements ContextCore
{
    private ThreadLocal<Map<String, String>> threadLocal;
    
    public ThreadLocalContextCore() {
        this.threadLocal = new InheritableThreadLocal<Map<String, String>>() {
            @Override
            protected Map<String, String> initialValue() {
                return new HashMap<String, String>();
            }
        };
    }
    
    @Override
    public String put(final String key, final String value) {
        return this.threadLocal.get().put(key, value);
    }
    
    @Override
    public String get(final String key) {
        return this.threadLocal.get().get(key);
    }
    
    @Override
    public String remove(final String key) {
        return this.threadLocal.get().remove(key);
    }
}
